SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
# find all files
declare -a fList=($(find . -mindepth 1 -type f -print))
# loop rename and move
for f in ${fList[@]}; do
    mv $f "$(dirname $f)-$(basename $f)"
done
# delete empty directorys
find . -mindepth 1 -type d -print0 | xargs --null rmdir
IFS=$SAVEIFS
